//
//  MessageCenterTableViewCell.m
//  ZYZB
//
//  Created by ENERGY on 2018/7/11.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "MessageCenterTableViewCell.h"

@interface MessageCenterTableViewCell()
@property (nonatomic, strong)UIImageView * arrowImgView;
//@property (nonatomic, strong)UIImageView * arrowImgView;
@end

@implementation MessageCenterTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        __weak typeof (self)weakSelf = self;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        int contentBtnW = 22/WIDTH_6_SCALE;
        
        UIView * lineView = [[UIView alloc] init];
        lineView.backgroundColor = getColor(grayColor);
        [self.contentView addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.bottom.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
        self.lineView = lineView;
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.contentBtn];
        [self.contentView addSubview:self.arrowImgView];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.lineView);
            make.top.equalTo(weakSelf.contentView);
            make.bottom.equalTo(weakSelf.lineView.mas_top);
        }];
        [self.contentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf.titleLab.mas_centerY);
            make.right.equalTo(weakSelf.arrowImgView.mas_left).mas_offset(-10/WIDTH_6_SCALE);
            make.width.height.mas_equalTo(22/WIDTH_6_SCALE);
        }];
        [self.arrowImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.lineView.mas_right);
            make.centerY.equalTo(weakSelf.titleLab.mas_centerY);
            make.height.mas_offset(11/WIDTH_6_SCALE);
            make.width.mas_offset(6/WIDTH_6_SCALE);
        }];
        self.contentBtn.layer.cornerRadius = contentBtnW/2;
    }return self;
}
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_12;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.text = @"交易通知";
    }return _titleLab;
}
- (UIButton *)contentBtn{
    if (!_contentBtn) {
        _contentBtn = [[UIButton alloc] init];
        _contentBtn.titleLabel.font = DEF_FontSize_12;
        [_contentBtn setTitle:@"2" forState:UIControlStateNormal];
        [_contentBtn setBackgroundColor:[UIColor orangeColor]];
        [_contentBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _contentBtn.layer.masksToBounds = YES;
    }
    return _contentBtn;
}
- (UIImageView *)arrowImgView{
    if (!_arrowImgView) {
        _arrowImgView = [[UIImageView alloc] init];
//        _arrowImgView.backgroundColor = [UIColor orangeColor];
        _arrowImgView.image = [UIImage imageNamed:@"in"];
    }return _arrowImgView;
}
@end
